<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="time">

		</div>
		<script type="text/javascript">
			//2. 计算现在到明年09-01的时间差, 然后开始倒计时,并输出在页面上, 输出格式: x天x小时x分钟x秒。
			var timer = setInterval(function() {
				var time1 = new Date();
				var time2 = new Date(2022, 9, 1);
				var days = (time2 - time1) / 1000 / 60 / 60 / 24;
				var hours = days % 1 * 24;
				var minutes = hours % 1 * 60;
				var second = minutes % 1 * 60;
				var n = parseInt(days) + "天" + parseInt(hours) + "小时" + parseInt(minutes) + "分钟" + parseInt(second) + "秒";
				document.getElementById("time").innerHTML = n;
			}, 1000);
		</script>
	</body>
</html>
